package helper

import "reflect"

func InArray(val interface{}, array interface{}) (exists bool, index int) {
	exists = false
	index = -1

	s := reflect.ValueOf(array)
	for i := 0; i < s.Len(); i++ {
		if reflect.DeepEqual(val, s.Index(i).Interface()) == true {
			index = i
			exists = true
			return
		}
	}
	return
}
